package com.rocky.ssm.service;

import com.rocky.ssm.mapper.TalkMapper;
import com.rocky.ssm.model.Talk;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by Administrator on 2017/8/15.
 */
@Service
public class CommunicationService implements ICommunication{

    @Autowired
    private TalkMapper talkMapper;

    @Override
    public Talk getTalkById(int id) {
        return talkMapper.selectByPrimaryKey(id);
    }

    @Override
    public List<Talk> getTalkList() {
        return talkMapper.selectTalkList();
    }

    @Override
    public int save(Talk talk) {
        return talkMapper.insert(talk);
    }

    @Override
    public int update(Talk talk) {
        return talkMapper.updateByPrimaryKey(talk);
    }

    @Override
    public int delete(int id) {
        return talkMapper.deleteByPrimaryKey(id);
    }
}
